﻿using System;
using System.Web.UI;


namespace mojoPortal.Web.RS.SBM
{
    public partial class RSManageAppointment : RSBasePage
    {
        int _CompanyId = 0;
        int _LocationId = 0;
        int _AppointmentId = 0;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.QueryString["locationid"]))
                _LocationId = Convert.ToInt32(Request.QueryString["locationid"].ToString());
            if (!String.IsNullOrEmpty(Request.QueryString["appointmentid"]))
                _AppointmentId = Convert.ToInt32(Request.QueryString["appointmentid"].ToString());

            if (!Page.IsPostBack)
            {
                InitializeReadyServicePage("Appointment");

                RSUserIdentity userIdentity = GetRSUserIdentity();
                _CompanyId = userIdentity.RSCompanyId;

                if (_CompanyId > 0)
                {
                    if (Request.QueryString["action"] == "add")
                        SetRSPageHeader("Add Appointment");
                    else
                        SetRSPageHeader("Edit Appointment");
                    if (_LocationId > 0)
                        ucAppointmentControl.LoadAppointmentByID(_CompanyId, _LocationId, _AppointmentId);
                }
            }
        }
    }
}